# -*- coding: utf-8 -*-
# Vincent Foley-Bourgon (vfoley <at> gmail <dot> com)
# PyoPaint

def argmin(L):
    if not L:
        raise ValueError("empty list")
    min_index = 0
    for i, v in enumerate(L):
        if v < L[min_index]:
            min_index = i
    return min_index
